<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SC2API: sc2::ClientEvents Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="SC2-Logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SC2API
   </div>
   <div id="projectbrief">An API for AI for StarCraft II</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><b>sc2</b></li><li class="navelem"><a class="el" href="classsc2_1_1_client_events.html">ClientEvents</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classsc2_1_1_client_events-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">sc2::ClientEvents Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A set of common events a user can override in their derived bot or replay observer class.  
 <a href="classsc2_1_1_client_events.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="sc2__client_8h_source.html">sc2_client.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for sc2::ClientEvents:</div>
<div class="dyncontent">
 <div class="center">
  <img src="classsc2_1_1_client_events.png" usemap="#sc2::ClientEvents_map" alt=""/>
  <map id="sc2::ClientEvents_map" name="sc2::ClientEvents_map">
<area href="classsc2_1_1_client.html" title="The base class for Agent and ReplayObserver. " alt="sc2::Client" shape="rect" coords="70,56,201,80"/>
<area href="classsc2_1_1_agent.html" title="The base class for user defined bots. " alt="sc2::Agent" shape="rect" coords="0,112,131,136"/>
<area href="classsc2_1_1_replay_observer.html" title="A client for running a replay. " alt="sc2::ReplayObserver" shape="rect" coords="141,112,272,136"/>
</map>
 </div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ab980f6942030d3a0cd42e00782742237"><td class="memItemLeft" align="right" valign="top"><a id="ab980f6942030d3a0cd42e00782742237"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#ab980f6942030d3a0cd42e00782742237">OnGameFullStart</a> ()</td></tr>
<tr class="memdesc:ab980f6942030d3a0cd42e00782742237"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a game is started after a load. Fast restarting will not call this. <br /></td></tr>
<tr class="separator:ab980f6942030d3a0cd42e00782742237"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6e2542b183f6ac980440cc93476163a3"><td class="memItemLeft" align="right" valign="top"><a id="a6e2542b183f6ac980440cc93476163a3"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a6e2542b183f6ac980440cc93476163a3">OnGameStart</a> ()</td></tr>
<tr class="memdesc:a6e2542b183f6ac980440cc93476163a3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a game is started or restarted. <br /></td></tr>
<tr class="separator:a6e2542b183f6ac980440cc93476163a3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2c5023d18ffc88bed76c844e643ef60d"><td class="memItemLeft" align="right" valign="top"><a id="a2c5023d18ffc88bed76c844e643ef60d"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a2c5023d18ffc88bed76c844e643ef60d">OnGameEnd</a> ()</td></tr>
<tr class="memdesc:a2c5023d18ffc88bed76c844e643ef60d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a game has ended. <br /></td></tr>
<tr class="separator:a2c5023d18ffc88bed76c844e643ef60d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6f5839e220d2a5a19b30065e0b8290c4"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a6f5839e220d2a5a19b30065e0b8290c4">OnStep</a> ()</td></tr>
<tr class="separator:a6f5839e220d2a5a19b30065e0b8290c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a17297ffdf866ab1f4c3c31de64a1bc59"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a17297ffdf866ab1f4c3c31de64a1bc59">OnUnitDestroyed</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *)</td></tr>
<tr class="separator:a17297ffdf866ab1f4c3c31de64a1bc59"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac7fc1dae3607d7e4fea5680bcea903a0"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#ac7fc1dae3607d7e4fea5680bcea903a0">OnUnitCreated</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *)</td></tr>
<tr class="separator:ac7fc1dae3607d7e4fea5680bcea903a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adce0fc98fa9c3cc092a5a8b3f2feef45"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#adce0fc98fa9c3cc092a5a8b3f2feef45">OnUnitIdle</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *)</td></tr>
<tr class="separator:adce0fc98fa9c3cc092a5a8b3f2feef45"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4cdc022420833b34fbcd1c9713096754"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a4cdc022420833b34fbcd1c9713096754">OnUpgradeCompleted</a> (<a class="el" href="classsc2_1_1_s_c2_type.html">UpgradeID</a>)</td></tr>
<tr class="separator:a4cdc022420833b34fbcd1c9713096754"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad920d34fe6c49487373800dd1ec45757"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#ad920d34fe6c49487373800dd1ec45757">OnBuildingConstructionComplete</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *)</td></tr>
<tr class="separator:ad920d34fe6c49487373800dd1ec45757"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afde152c65ab94bdb57e345a8fd1532aa"><td class="memItemLeft" align="right" valign="top"><a id="afde152c65ab94bdb57e345a8fd1532aa"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#afde152c65ab94bdb57e345a8fd1532aa">OnNydusDetected</a> ()</td></tr>
<tr class="memdesc:afde152c65ab94bdb57e345a8fd1532aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a nydus is placed. <br /></td></tr>
<tr class="separator:afde152c65ab94bdb57e345a8fd1532aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab9923f256e3bf6e518ccb8ec26f8ae88"><td class="memItemLeft" align="right" valign="top"><a id="ab9923f256e3bf6e518ccb8ec26f8ae88"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#ab9923f256e3bf6e518ccb8ec26f8ae88">OnNuclearLaunchDetected</a> ()</td></tr>
<tr class="memdesc:ab9923f256e3bf6e518ccb8ec26f8ae88"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called when a nuclear launch is detected. <br /></td></tr>
<tr class="separator:ab9923f256e3bf6e518ccb8ec26f8ae88"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3d73b5a3462f757397ea5ac2f4aca8dc"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a3d73b5a3462f757397ea5ac2f4aca8dc">OnUnitEnterVision</a> (const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *)</td></tr>
<tr class="separator:a3d73b5a3462f757397ea5ac2f4aca8dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a35424cb2a0baa509f997149521ab2c52"><td class="memItemLeft" align="right" valign="top"><a id="a35424cb2a0baa509f997149521ab2c52"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsc2_1_1_client_events.html#a35424cb2a0baa509f997149521ab2c52">OnError</a> (const std::vector&lt; <a class="el" href="sc2__client_8h.html#ac7d3e3694a208204e099f04c1e5eded0">ClientError</a> &gt; &amp;, const std::vector&lt; std::string &gt; &amp;={})</td></tr>
<tr class="memdesc:a35424cb2a0baa509f997149521ab2c52"><td class="mdescLeft">&#160;</td><td class="mdescRight">Called for various errors the library can encounter. See ClientError enum for possible errors. <br /></td></tr>
<tr class="separator:a35424cb2a0baa509f997149521ab2c52"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>A set of common events a user can override in their derived bot or replay observer class. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="ad920d34fe6c49487373800dd1ec45757"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad920d34fe6c49487373800dd1ec45757">&#9670;&nbsp;</a></span>OnBuildingConstructionComplete()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnBuildingConstructionComplete </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when the unit in the previous step had a build progress less than 1.0 but is greater than or equal to 1.0 in the current step. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unit</td><td>The constructed unit. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a6f5839e220d2a5a19b30065e0b8290c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6f5839e220d2a5a19b30065e0b8290c4">&#9670;&nbsp;</a></span>OnStep()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnStep </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>In non realtime games this function gets called after each step as indicated by step size. In realtime this function gets called as often as possible after request/responses are received from the game gathering observation state. </p>

</div>
</div>
<a id="ac7fc1dae3607d7e4fea5680bcea903a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac7fc1dae3607d7e4fea5680bcea903a0">&#9670;&nbsp;</a></span>OnUnitCreated()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnUnitCreated </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when a <a class="el" href="classsc2_1_1_unit.html" title="A unit. Could be a structure, a worker or a military unit. ">Unit</a> has been created by the player. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unit</td><td>The created unit. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a17297ffdf866ab1f4c3c31de64a1bc59"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a17297ffdf866ab1f4c3c31de64a1bc59">&#9670;&nbsp;</a></span>OnUnitDestroyed()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnUnitDestroyed </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called whenever one of the player's units has been destroyed. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unit</td><td>The destroyed unit. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a3d73b5a3462f757397ea5ac2f4aca8dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3d73b5a3462f757397ea5ac2f4aca8dc">&#9670;&nbsp;</a></span>OnUnitEnterVision()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnUnitEnterVision </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when an enemy unit enters vision from out of fog of war. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unit</td><td>The unit entering vision. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="adce0fc98fa9c3cc092a5a8b3f2feef45"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adce0fc98fa9c3cc092a5a8b3f2feef45">&#9670;&nbsp;</a></span>OnUnitIdle()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnUnitIdle </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsc2_1_1_unit.html">Unit</a> *&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when a unit becomes idle, this will only occur as an event so will only be called when the unit becomes idle and not a second time. Being idle is defined by having orders in the previous step and not currently having orders or if it did not exist in the previous step and now does, a unit being created, for instance, will call both OnUnitCreated and OnUnitIdle if it does not have a rally set. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">unit</td><td>The idle unit. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a4cdc022420833b34fbcd1c9713096754"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4cdc022420833b34fbcd1c9713096754">&#9670;&nbsp;</a></span>OnUpgradeCompleted()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void sc2::ClientEvents::OnUpgradeCompleted </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classsc2_1_1_s_c2_type.html">UpgradeID</a>&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Called when an upgrade is finished, warp gate, ground weapons, baneling speed, etc. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">upgrade</td><td>The completed upgrade. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>include/sc2api/<a class="el" href="sc2__client_8h_source.html">sc2_client.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
